#ifndef __ZHU_OS_KERNEL64_IDT_H__
#define __ZHU_OS_KERNEL64_IDT_H__
#include "types.h"

typedef struct _idtr_data_t {
    ushort limit;
    int64 base;
} __attribute__((packed)) idtr_data_t;

typedef struct _idt_item_t 
{
    short offset0;
    short selector;
    char ist;
    char type:4; // 任务门/中断门/陷阱门
    char segment  : 1;
    char dpl : 2; // 使用int指令访问的最低权限
    char present : 1;
    short offset1;
    int offset2;
    int reserved;
} __attribute__((packed)) idt_item_t;

void install_idt_item(int index, int64 handler, short selector, char ist, char dpl);

void idt_init();

void send_eoi(int idt_index);

#endif